package com.cn.por.auto.factory;

import java.util.ArrayList;
import java.util.List;

import com.cn.por.auto.dto.DataModel;
import com.cn.por.auto.dto.ModelParam;

public class ServiceDataModelFactory extends InterfaceDataModelFactory {
	
	public ServiceDataModelFactory() {}

	@Override
	public void setProperties(ModelParam modelParam) {
		super.setProperties(modelParam);
		String injectClass = super.interfaceDataModel.getEntityName()+"Dao";
		interfaceDataModel.setInjectClass(injectClass);
		interfaceDataModel.getImportPackage().add("org.springframework.beans.factory.annotation.Autowired");
		interfaceDataModel.getImportPackage().add(modelParam.getBasePackage()+".service."+interfaceDataModel.getEntityName()+"Service");
		interfaceDataModel.getImportPackage().add(modelParam.getBasePackage()+".dao."+interfaceDataModel.getEntityName()+"Dao");
		interfaceDataModel.setBaseInterfaceName(super.interfaceDataModel.getEntityName()+"Service");
		interfaceDataModel.getImportPackage().add("org.springframework.stereotype.Service");
		List<String> annotations = new ArrayList<String>();
		annotations.add("Service");
		interfaceDataModel.setAnnotations(annotations);
		interfaceDataModel.setFolder(interfaceDataModel.getPackageName().replace(".", "/"));
	}
	
	@Override
	public DataModel getDataModel() {
		return super.getDataModel();
	}

}
